#include <iostream>
using namespace std;

int monkey(int n){
    int prev = 1;
    for(int i = n - 1; i >= 1; i--){
        prev = 2 * (prev + 1);
    }

    return prev;
}

float func(int n) {
    if (n < 2) {
        return 0.0f; // 如果 n 小于 2，直接返回 0
    }
    float res = 0;
    int arr[30] = {0}; // 假设 n 不会超过 29
    arr[0] = 1;
    arr[1] = 1;

    for (int i = 2; i <= n; i++) {
        arr[i] = arr[i - 1] + arr[i - 2];
        cout << "arr[" << i << "] = " << arr[i] << endl;
    }

    for (int i = 0; i < n - 1; ++i) { // 避免访问 arr[n]
        res += (float)arr[i] / arr[i + 1];
        cout << "res = " << res << endl;
    }

    return res;
}

int main(){
    cout << monkey(10) << endl;


    int n = 20;
    float result = func(n);
    cout << result << endl;

    return 0;
}